package ioperation;

import book.Book;
import book.BookList;
import com.sun.org.apache.xpath.internal.operations.Bool;

import java.util.Scanner;

public class Add implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("添加图书");
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入书名");
        String name = scan.next();
        System.out.println("请输入作者");
        String author = scan.next();
        System.out.println("请输入价格");
        Double price = scan.nextDouble();
        Book book  = new Book(name,author,price);
        int pos = bookList.getUsedsize();
        bookList.setBook(pos,book);
        bookList.setUsedsize(pos+1);

    }
}
